<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>首页</title>
</head>
<body>
    <h3>欢迎回来：<span id="spUsername">昵称</span></h3>

    <!-- 文件路径（可能会改） -->
    <!-- <script src="../js/cookies.js"></script> -->

    <!-- 网络URL 相对稳定 -->
    <script src="/file/js/cookies.js"></script>

    <script>
        // 读取logined这一cookie
        const logined = getCookie("logined")

        // 如果有值=用户已登录
        if(logined){
            // 进一步读取username 显示在spUsername上
            spUsername.innerText = getCookie("username")
        }
        
        // 否则说明用户未登录 一脚踹到登录页
    </script>
</body>
</html>